/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.udt.generator.core.rtgenerator.manager;


import com.inspur.edp.caf.generator.BaseGenerator;
import com.inspur.edp.caf.generator.item.ClassGeneratorContext;
import com.inspur.edp.caf.generator.method.ClassMethodGenerator;
import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.ValueObjManagerGenerator;

import com.inspur.edp.udt.core.Manager.AbstractUdtManager;
import com.inspur.edp.udt.generator.core.rtgenerator.manager.dataconverter.DataConverterGenerator;
import com.inspur.edp.udt.generator.core.rtgenerator.manager.dataconverter.DataDeSerializerGenerator;
import com.inspur.edp.udt.generator.core.rtgenerator.manager.dataconverter.GetChangeDeserGenerator;
import com.inspur.edp.udt.generator.core.rtgenerator.manager.dataconverter.GetChangeSerializerGenerator;
import com.inspur.edp.udt.generator.core.rtgenerator.manager.dataconverter.UdtDataSerGenerator;
import java.util.ArrayList;
import java.util.List;

public class UdtManagerImplGenerator extends ValueObjManagerGenerator
{
	private UdtMgrGenCtx mgrGenCtx;
	public UdtManagerImplGenerator(UdtMgrGenCtx mgrGenCtx)
	{
		super(mgrGenCtx);
		this.mgrGenCtx = mgrGenCtx;
	}

//C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing via the 'new' keyword:
//ORIGINAL LINE: private new MgrImplGenCtx Context => (MgrImplGenCtx)super.Context;
	private MgrImplGenCtx getUdtMgrImplGenContext (){return (MgrImplGenCtx)super.getContext();}

	@Override
	protected ClassGeneratorContext createClassInfoContext()
	{
		return new MgrImplGenCtx(mgrGenCtx);
	}

	@Override
	protected Class getImplParentClassType() {
		return AbstractUdtManager.class;
	}

	@Override
	protected List<ClassMethodGenerator> getMgrActionGenerators() {
		return null;
	}

	@Override
	protected void addExtendMethodGenerator(java.util.ArrayList<ClassMethodGenerator> generators)
	{
		super.addExtendMethodGenerator(generators);
		generators.add(new CreateAbstractUdtGenerator(mgrGenCtx));
		generators.add(new CreateDataConverterGenerator(getUdtMgrImplGenContext()));
		generators.add(new GetDataDeserializerGenerator(getUdtMgrImplGenContext()));
		generators.add(new GetChangeSerializerGenerator(mgrGenCtx));
		generators.add(new GetChangeDeserGenerator(mgrGenCtx));
		generators.add(new UdtMgrGetRepositoryGenerator(getUdtMgrImplGenContext()));
		generators.add(new UdtGetModelInfosMethodGenerator(mgrGenCtx));
	}

	@Override
	protected java.util.ArrayList<BaseGenerator> createClassExtendChildGenrators()
	{
		java.util.ArrayList<BaseGenerator> rez=super.createClassExtendChildGenrators();
		if(rez==null)
			rez=new ArrayList<>();
		rez.add(new UdtDataSerGenerator(getUdtMgrImplGenContext(),mgrGenCtx));
//		rez.add(new DataDeSerializerGenerator(getUdtMgrImplGenContext()));
		return rez;
	}

	protected boolean isGenerateI18n (){return true;}

	@Override
	protected String getName() {
		return this.mgrGenCtx.getCoreGenCtx().getUdtGenContext().getUdt().getCode() + "Manager";
	}
}
